package com.aprointeractive.android.justwar.activity;

import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.util.Log;

public class DevTestPlugin extends CordovaPlugin {
	public final String TAG = "TestPlugin";
	public boolean execute(String action, JSONArray args,
			CallbackContext callbackContext) throws JSONException {
		Log.e(TAG, "execute Test Plugin");

		showAlertDialog("Action : " + action + "\n" + "args : " + args.toString());
		
		return false;
	}
	
	public static void showAlertDialog(String message) {
		new AlertDialog.Builder(JustwarActivity.context)
		.setTitle("DevTestPlugin").setMessage(message)
		.setPositiveButton("확인", new OnClickListener() {

			@Override
			public void onClick(DialogInterface dialog, int which) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			}
		}).show();
	}
}